import 'package:aio/aio.dart';
import 'package:flutter/cupertino.dart';
import 'package:app/generated/app_strings.dart';
import 'package:app/src/utils/status_utils.dart';

import 'contract_bean_super.dart';

///合同审核
class ContractCopyInfo extends SuperContractCopyInfo {
  /// 合同副本编号
  String? ContractId = "";
  String? Contractid = "";

  /// 合同编号
  String? ContractCode = "";

  String? getContractCode() {
    if (StringUtils.isNotEmpty(ContractCode)) {
      return ContractCode;
    }
    if (StringUtils.isNotEmpty(ContractId)) {
      return ContractId;
    }
    return "";
  }

  /// 项目名称
  String? ProjectName = "";
  String? Projectname = "";

  /// 客户名称
  String? CustomerName = "";
  String? Customername = "";

  /// 跟单员姓名(客服经理)
  String? MerchandiserName = "";
  String? Merchandisername = "";

  /// 业务员姓名(销售经理)
  String? SalesmanName = "";
  String? Salesmanname = "";

  /// 提交日期
  String? InsertDatetime = "";

  /// 当前环节 fixme (在列表信息里有，详情里没有)；如：合同审核(部门审核)
  String? YwxName = "";

  // N6033 开票审核(财务)
  // N6034 开票审核(总经理)
  // N6043 待开发票
  // N6046 收款入账（包含已结束）
  // N6036 确认收款
  String? YwxId = "";

  //当前节点
  String? CurrentId = "";

  /// 是否新客户
  String? NewCustomer = "";

  /// 客户ID
  String? CustomerId = "";

  /// 客户编码(客户编号)
  String? CustomerCode = "";

  /// 签订日期;如：2023-02-09-16:33
  String? SignDate = "";

  String? _SignDate = "";

  ///获取签订日期，去除后面的时间。
  String? getSignDate() {
    if (StringUtils.isEmpty(_SignDate)) {
      _SignDate = SignDate?.split(" ")[0];
    }
    return _SignDate;
  }

  /// 完结日期
  String? CompleteDate = "";

  /// 合同金额
  String? CreditMonth = "";

  /// 合同类型
  String? ContractType = "";

  /// 合同类型名称
  String? ContractTypeName = "";

  /// 联系地址
  String? Address = "";

  /// 联系人
  String? LinkMan = "";

  /// 联系电话
  String? Telephone = "";

  /// 传真
  String? Fax = "";

  /// 包装要求
  String? Package = "";

  /// 包装要求名称
  String? PackageName = "";

  /// 发货要求
  String? DeliveryMethods = "";

  /// 发货要求名称
  String? DeliveryMethodsName = "";

  /// 结算要求
  String? AccountMethods = "";

  /// 标准面积
  String? StandardArea = "";

  /// 结算面积
  String? AccountArea = "";

  /// 销售公司
  String? CompanyId = "";

  /// 销售公司名称
  String? CompanyName = "";

  /// 质量标准
  String? QualityType = "";

  /// 质量标准名称
  String? QualityTypeName = "";

  /// 打印单价
  String? PrintMoney = "";

  /// 打印单价名称
  String? PrintMoneyName = "";

  /// 是否外贸
  String? IsForeign = "";

  /// 是否外贸名称
  String? IsForeignName = "";

  /// 结算货币
  String? CurrencyType = "";

  /// 结算货币名称
  String? CurrencyTypeName = "";

  /// 异形面积
  String? AbnormityArea = "";

  /// 异形面积
  String? AbnormityAreaName = "";

  /// 冲抵方式
  String? AdvanceOffsetMode = "";

  /// 冲抵方式名称
  String? AdvanceOffsetModeName = "";

  /// 首批冲抵比例
  String? AdvanceOffSetPercent = "";

  /// 末批冲抵比例
  String? AdvanceOffsetPercentFinal = "";

  /// 税码
  String? TaxCode = "";

  /// 结算税率
  String? TaxRate = "";

  /// 开户行
  String? BkCode = "";

  /// 银行账号
  String? BkAccountNum = "";

  /// 合同备注
  String? ContractContent = "";

  /**
   * fixme 订单审核新增参数
   */

  //产品类别
  String? ProductClass = "";

  /// 产品名称
  String? ProductName = "";

  /// 下单方式（1：普通下单，2：快速下单，3：备货下单）
  String? OrderFromType = "";

  /// 下单方式文本
  String? OrderFromTypeName = "";

  //订单编号；列表里，目前就 订单审核，冻结解冻审核，工厂更换审核 使用。
  String? OrderCode = "";

  /// 订单编号（外部）
  String? OrderOutCode = "";

  /// 片数（列表）
  String? Num = "";

  /// PoCode批次号
  String? PoCode = "";

  /// 面积（列表）
  String? Area = "";

  /// 实际面积（列表）
  String? OrdersTrueSqm = "";

  ///合同外部编号
  String? OutCode = "";

  /// 订单状态0：普通，1：审核中，2：已审核，3：已分组，4：部分分架，5：已分架，6：生产中，7：生产完成，8：入库完成，9：出库完成,10:已分箱 ，-1：出错，1000：冻结，1001：作废，1002：驳回，1003：客户取消订单
  //审核状态编码；订单状态（编号）
  String? OrderType = "";

  ///审核状态名称
  String? OrderTypeName = "";

  ///判断是否已审核；true 已审核（显示：查看），未审核 false（显示：审核，可以操作）
  String? IsApproval = "";

  //优先级会比IsApproval更高。
  String? ApprovalState = ""; //4 代表已退回；详情页面可以操作作废(终止)，重新上报。

  /**
   * fixme 送货地址审核
   */
  String? Status = ""; //": "1",单据状态，审核状态

  String? StatusName = ""; //状态名称，如："待审核",

  String? PersonName = ""; //申请人,制单人
  String? TheName = ""; //姓名

  ///申请时间;入库日期;添加日期;入账日期;提交日期;通知日期
  String? AddDate = "";

  String? FaId = "";

  /**
   * fixme 合同特殊设置
   */
  String? OdId = "";

  /**
   * fixme 开票审核
   */
  String? ReceiptTitle = ""; //发票抬头

  String? ReceiptType = ""; //发票类型

  /**
   * fixme 发货审核
   */
  String? NoticeDatetime = ""; //通知日期

  String? DeliveryDatetime = ""; //通知发货日期

  String? NoticeId = ""; //通知单号

  /// 主键Id
  String? NId = "";

  /**
   * fixme 免款审核
   */
  String? FreeType = ""; //免款类型

  String? ApplicationCode = ""; //申请类型(申请单号)
  String? Applicationcode = "";
  String? Amount = ""; //金额：免款金额；退货金额;发票金额;实收金额

  String? FactoryName = "";

  //FIXME 当前位置，如：退货审核，退货不补
  String? ReviewTypePosition = "";

  /// 中空胶深;目前，GlueDeepType返回的是 "";，"标准", "特殊"
  String? GlueDeepType = "";

  /// 胶深数值
  String? OtherGlueDeep = "";

  /**
   * fixme 派工审核
   */
  String? ApplicationTypeName = ""; //申请类型
  String? ApplicationClassName = ""; //申请班组
  String? ApplicationClassId = ""; //申请班组id
  String OnWorkTime = ""; //班次开始时间
  String OffWorkTime = ""; //班次结束时间
  String WorkingHours = ""; //申请工时
  String ApplyForReason = ""; //申请原因
  String RelatedAttendance = ""; //相关出勤
  String DispatchType = ""; //派工类型编码，fixme 新增字段
  String DispatchTypeName="";//派工类型名称

  /**
   * fixme 外车运费审核
   */

  /**
   * fixme 保底审核
   */
  String MinWorkingHours = ""; //最少工作工时

  /**
   * fixme 加班审核
   */
  String? Gender = ""; //性别
  String? MobilePhone = ""; //手机
  String? EmployeesNature = ""; //员工性质
  String? EmployeesState = ""; //员工状态
  String? ToAuditNumber = ""; //待审核数量
  String? OvertimeHours = ""; //总加班时长（分钟）
  String? CouldOvertime = ""; //可否加班
  @override
  fromJson(Map<String, dynamic> json) {
    // TODO: implement fromJson
    super.fromJson(json); //fixme 先实现父类的
    ContractId = json["ContractId"]?.toString() ?? "";
    Contractid = json["Contractid"]?.toString() ?? "";
    if (StringUtils.isEmpty(Contractid)) {
      Contractid = ContractId;
    }
    if (StringUtils.isEmpty(ContractId)) {
      ContractId = Contractid;
    }
    ContractCode = json["ContractCode"] ?? "";
    ProjectName = json["ProjectName"]?.toString() ?? "";
    Projectname = json["Projectname"]?.toString() ?? "";
    if (StringUtils.isEmpty(Projectname)) {
      Projectname = ProjectName;
    }
    if (StringUtils.isEmpty(ProjectName)) {
      ProjectName = Projectname;
    }
    CustomerName = json["CustomerName"]?.toString() ?? "";
    Customername = json["Customername"]?.toString() ?? "";
    if (StringUtils.isEmpty(CustomerName)) {
      CustomerName = Customername;
    }
    if (StringUtils.isEmpty(Customername)) {
      Customername = CustomerName;
    }
    MerchandiserName = json["MerchandiserName"] ?? "";
    Merchandisername = json["Merchandisername"] ?? "";
    if (StringUtils.isEmpty(Merchandisername)) {
      Merchandisername = MerchandiserName;
    }
    if (StringUtils.isEmpty(MerchandiserName)) {
      MerchandiserName = Merchandisername;
    }
    SalesmanName = json["SalesmanName"]?.toString() ?? "";
    Salesmanname = json["Salesmanname"]?.toString() ?? "";
    if (StringUtils.isEmpty(SalesmanName)) {
      SalesmanName = Salesmanname;
    }
    if (StringUtils.isEmpty(Salesmanname)) {
      Salesmanname = SalesmanName;
    }
    InsertDatetime = json["InsertDatetime"]?.toString() ?? "";
    YwxName = json["YwxName"]?.toString() ?? "";
    YwxId = json["YwxId"]?.toString() ?? "";
    CurrentId = json["CurrentId"]?.toString() ?? "";
    NewCustomer = json["NewCustomer"]?.toString() ?? "";
    CustomerId = json["CustomerId"]?.toString() ?? "";
    CustomerCode = json["CustomerCode"]?.toString() ?? "";
    SignDate = json["SignDate"]?.toString() ?? "";
    CompleteDate = json["CompleteDate"]?.toString() ?? "";
    CreditMonth = json["CreditMonth"]?.toString() ?? "";
    ContractType = json["ContractType"]?.toString() ?? "";
    ContractTypeName = json["ContractTypeName"]?.toString() ?? "";
    Address = json["Address"]?.toString() ?? "";
    LinkMan = json["LinkMan"]?.toString() ?? "";
    Telephone = json["Telephone"]?.toString() ?? "";
    Fax = json["Fax"]?.toString() ?? "";
    Package = json["Package"]?.toString() ?? "";
    PackageName = json["PackageName"]?.toString() ?? "";
    DeliveryMethods = json["DeliveryMethods"]?.toString() ?? "";
    DeliveryMethodsName = json["DeliveryMethodsName"]?.toString() ?? "";
    AccountMethods = json["AccountMethods"]?.toString() ?? "";
    StandardArea = json["StandardArea"]?.toString() ?? "";
    AccountArea = json["AccountArea"]?.toString() ?? "";
    CompanyId = json["CompanyId"]?.toString() ?? "";
    CompanyName = json["CompanyName"]?.toString() ?? "";
    QualityType = json["QualityType"]?.toString() ?? "";
    QualityTypeName = json["QualityTypeName"]?.toString() ?? "";
    PrintMoney = json["PrintMoney"]?.toString() ?? "";
    PrintMoneyName = json["PrintMoneyName"]?.toString() ?? "";
    IsForeign = json["IsForeign"]?.toString() ?? "";
    IsForeignName = json["IsForeignName"]?.toString() ?? "";
    CurrencyType = json["CurrencyType"]?.toString() ?? "";
    CurrencyTypeName = json["CurrencyTypeName"]?.toString() ?? "";
    AbnormityArea = json["AbnormityArea"]?.toString() ?? "";
    AbnormityAreaName = json["AbnormityAreaName"]?.toString() ?? "";
    AdvanceOffsetMode = json["AdvanceOffsetMode"]?.toString() ?? "";
    AdvanceOffsetModeName = json["AdvanceOffsetModeName"]?.toString() ?? "";
    AdvanceOffSetPercent = json["AdvanceOffSetPercent"]?.toString() ?? "";
    AdvanceOffsetPercentFinal =
        json["AdvanceOffsetPercentFinal"]?.toString() ?? "";
    TaxCode = json["TaxCode"]?.toString() ?? "";
    TaxRate = json["TaxRate"]?.toString() ?? "";
    BkCode = json["BkCode"]?.toString() ?? "";
    BkAccountNum = json["BkAccountNum"]?.toString() ?? "";
    ContractContent = json["ContractContent"]?.toString() ?? "";
    ProductClass = json["ProductClass"]?.toString() ?? "";
    ProductName = json["ProductName"]?.toString() ?? "";
    OrderFromType = json["OrderFromType"]?.toString() ?? "";
    OrderFromTypeName = json["OrderFromTypeName"]?.toString() ?? "";
    OrderCode = json["OrderCode"]?.toString() ?? "";
    OrderOutCode = json["OrderOutCode"]?.toString() ?? "";
    Num = json["Num"]?.toString() ?? "";
    PoCode = json["PoCode"]?.toString() ?? "";
    Area = json["Area"]?.toString() ?? "";
    OrdersTrueSqm = json["OrdersTrueSqm"]?.toString() ?? "";
    OutCode = json["OutCode"]?.toString() ?? "";
    OrderType = json["OrderType"]?.toString() ?? "";
    OrderTypeName = json["OrderTypeName"]?.toString() ?? "";
    IsApproval = json["IsApproval"]?.toString() ?? "";
    ApprovalState = json["ApprovalState"]?.toString() ?? "";
    Status = json["Status"]?.toString() ?? "";
    StatusName = json["StatusName"]?.toString() ?? "";
    PersonName = json["PersonName"]?.toString() ?? "";
    TheName = json["TheName"]?.toString() ?? "";
    AddDate = json["AddDate"]?.toString() ?? "";
    FaId = json["FaId"]?.toString() ?? "";
    OdId = json["OdId"]?.toString() ?? "";
    ReceiptTitle = json["ReceiptTitle"]?.toString() ?? "";
    ReceiptType = json["ReceiptType"]?.toString() ?? "";
    NoticeDatetime = json["NoticeDatetime"]?.toString() ?? "";
    DeliveryDatetime = json["DeliveryDatetime"]?.toString() ?? "";
    NoticeId = json["NoticeId"]?.toString() ?? "";
    NId = json["NId"]?.toString() ?? "";
    FreeType = json["FreeType"]?.toString() ?? "";
    ApplicationCode = json["ApplicationCode"]?.toString() ?? "";
    Applicationcode = json["Applicationcode"]?.toString() ?? "";
    if (StringUtils.isEmpty(Applicationcode)) {
      Applicationcode = ApplicationCode;
    }
    if (StringUtils.isEmpty(ApplicationCode)) {
      ApplicationCode = Applicationcode;
    }
    Amount = json["Amount"]?.toString() ?? "";
    FactoryName = json["FactoryName"]?.toString() ?? "";
    ReviewTypePosition = json["ReviewTypePosition"]?.toString() ?? "";
    GlueDeepType = json["GlueDeepType"]?.toString() ?? "";
    OtherGlueDeep = json["OtherGlueDeep"]?.toString() ?? "";
    ApplicationTypeName = json["ApplicationTypeName"]?.toString() ?? "";
    OnWorkTime = json["OnWorkTime"]?.toString() ?? "";
    OffWorkTime = json["OffWorkTime"]?.toString() ?? "";
    WorkingHours = json["WorkingHours"]?.toString() ?? "";
    ApplyForReason = json["ApplyForReason"]?.toString() ?? "";
    ApplicationClassId = json["ApplicationClassId"]?.toString() ?? "";
    ApplicationClassName = json["ApplicationClassName"]?.toString() ?? "";
    Gender = json["Gender"]?.toString() ?? "";
    MobilePhone = json["MobilePhone"]?.toString() ?? "";
    EmployeesNature = json["EmployeesNature"]?.toString() ?? "";
    EmployeesState = json["EmployeesState"]?.toString() ?? "";
    ToAuditNumber = json["ToAuditNumber"]?.toString() ?? "";
    OvertimeHours = json["OvertimeHours"]?.toString() ?? "";
    CouldOvertime = json["CouldOvertime"]?.toString() ?? "";
    MinWorkingHours = json["MinWorkingHours"]?.toString() ?? "";
    RelatedAttendance = json["RelatedAttendance"]?.toString() ?? "";
    DispatchType = json["DispatchType"]?.toString() ?? "";
    DispatchTypeName = json["DispatchTypeName"]?.toString() ?? "";
  }

  @override
  instance() {
    // TODO: implement instance
    return ContractCopyInfo();
  }

  @override
  Map<String, dynamic> toJson() {
    // TODO: implement toJson
    var map = super.toJson(); //fixme 先继承父类的
    //var map = <String, dynamic>{};
    map["ReviewTypeId"] = ReviewTypeId;
    map["ReviewTypeName"] = ReviewTypeName;
    if (StringUtils.isNotEmpty(ContractId)) {
      Contractid = ContractId;
    }
    if (StringUtils.isNotEmpty(Contractid)) {
      ContractId = Contractid;
    }
    map["ContractId"] = ContractId;
    map["Contractid"] = Contractid;
    map["ContractCode"] = ContractCode;
    if (StringUtils.isNotEmpty(ProjectName)) {
      Projectname = ProjectName;
    }
    if (StringUtils.isNotEmpty(Projectname)) {
      ProjectName = Projectname;
    }
    map["ProjectName"] = ProjectName;
    map["Projectname"] = Projectname;
    if (StringUtils.isNotEmpty(CustomerName)) {
      Customername = CustomerName;
    }
    if (StringUtils.isNotEmpty(Customername)) {
      CustomerName = Customername;
    }
    map["CustomerName"] = CustomerName;
    map["Customername"] = Customername;
    if (StringUtils.isNotEmpty(MerchandiserName)) {
      Merchandisername = MerchandiserName;
    }
    if (StringUtils.isNotEmpty(Merchandisername)) {
      MerchandiserName = Merchandisername;
    }
    map["MerchandiserName"] = MerchandiserName;
    map["Merchandisername"] = Merchandisername;
    if (StringUtils.isNotEmpty(SalesmanName)) {
      Salesmanname = SalesmanName;
    }
    if (StringUtils.isNotEmpty(Salesmanname)) {
      SalesmanName = Salesmanname;
    }
    map["SalesmanName"] = SalesmanName;
    map["Salesmanname"] = Salesmanname;
    map["InsertDatetime"] = InsertDatetime;
    map["YwxName"] = YwxName;
    map["YwxId"] = YwxId;
    map["CurrentId"] = CurrentId;
    map["NewCustomer"] = NewCustomer;
    map["CustomerId"] = CustomerId;
    map["CustomerCode"] = CustomerCode;
    map["SignDate"] = SignDate;
    map["CompleteDate"] = CompleteDate;
    map["CreditMonth"] = CreditMonth;
    map["ContractType"] = ContractType;
    map["ContractTypeName"] = ContractTypeName;
    map["Address"] = Address;
    map["LinkMan"] = LinkMan;
    map["Telephone"] = Telephone;
    map["Fax"] = Fax;
    map["Package"] = Package;
    map["PackageName"] = PackageName;
    map["DeliveryMethods"] = DeliveryMethods;
    map["DeliveryMethodsName"] = DeliveryMethodsName;
    map["AccountMethods"] = AccountMethods;
    map["StandardArea"] = StandardArea;
    map["AccountArea"] = AccountArea;
    map["CompanyId"] = CompanyId;
    map["CompanyName"] = CompanyName;
    map["QualityType"] = QualityType;
    map["QualityTypeName"] = QualityTypeName;
    map["PrintMoney"] = PrintMoney;
    map["PrintMoneyName"] = PrintMoneyName;
    map["IsForeign"] = IsForeign;
    map["IsForeignName"] = IsForeignName;
    map["CurrencyType"] = CurrencyType;
    map["CurrencyTypeName"] = CurrencyTypeName;
    map["AbnormityArea"] = AbnormityArea;
    map["AbnormityAreaName"] = AbnormityAreaName;
    map["AdvanceOffsetMode"] = AdvanceOffsetMode;
    map["AdvanceOffsetModeName"] = AdvanceOffsetModeName;
    map["AdvanceOffSetPercent"] = AdvanceOffSetPercent;
    map["AdvanceOffsetPercentFinal"] = AdvanceOffsetPercentFinal;
    map["TaxCode"] = TaxCode;
    map["TaxRate"] = TaxRate;
    map["BkCode"] = BkCode;
    map["BkAccountNum"] = BkAccountNum;
    map["ContractContent"] = ContractContent;
    map["ProductClass"] = ProductClass;
    map["ProductName"] = ProductName;
    map["OrderFromType"] = OrderFromType;
    map["OrderFromTypeName"] = OrderFromTypeName;
    map["OrderCode"] = OrderCode;
    map["OrderOutCode"] = OrderOutCode;
    map["Num"] = Num;
    map["PoCode"] = PoCode;
    map["Area"] = Area;
    map["OrdersTrueSqm"] = OrdersTrueSqm;
    map["OutCode"] = OutCode;
    map["OrderType"] = OrderType;
    map["OrderTypeName"] = OrderTypeName;
    map["IsApproval"] = IsApproval;
    map["ApprovalState"] = ApprovalState;
    map["Status"] = Status;
    map["StatusName"] = StatusName;
    map["PersonName"] = PersonName;
    map["TheName"] = TheName;
    map["AddDate"] = AddDate;
    map["FaId"] = FaId;
    map["OdId"] = OdId;
    map["ReceiptTitle"] = ReceiptTitle;
    map["ReceiptType"] = ReceiptType;
    map["NoticeDatetime"] = NoticeDatetime;
    map["DeliveryDatetime"] = DeliveryDatetime;
    map["NoticeId"] = NoticeId;
    map["NId"] = NId;
    map["FreeType"] = FreeType;
    map["ApplicationCode"] = ApplicationCode;
    map["Applicationcode"] = Applicationcode;
    map["Amount"] = Amount;
    map["FactoryName"] = FactoryName;
    map["ReviewTypePosition"] = ReviewTypePosition;
    map["GlueDeepType"] = GlueDeepType;
    map["OtherGlueDeep"] = OtherGlueDeep;
    map["ApplicationTypeName"] = ApplicationTypeName;
    map["OnWorkTime"] = OnWorkTime;
    map["OffWorkTime"] = OffWorkTime;
    map["WorkingHours"] = WorkingHours;
    map["ApplyForReason"] = ApplyForReason;
    map["ApplicationClassId"] = ApplicationClassId;
    map["ApplicationClassName"] = ApplicationClassName;
    map["Gender"] = Gender;
    map["MobilePhone"] = MobilePhone;
    map["EmployeesNature"] = EmployeesNature;
    map["EmployeesState"] = EmployeesState;
    map["ToAuditNumber"] = ToAuditNumber;
    map["OvertimeHours"] = OvertimeHours;
    map["CouldOvertime"] = CouldOvertime;
    map["MinWorkingHours"] = MinWorkingHours;
    map["RelatedAttendance"] = RelatedAttendance;
    map["DispatchType"] = DispatchType;
    map["DispatchTypeName"] = DispatchTypeName;
    return map;
  }

  //开票审核；判断是否导出NC或金锐单据
  bool isNC() {
    if (YwxId == "N6043") {
      return true; //fixme 导出单据
    }
    return false; //fixme 提交审核
  }

  //确认收款，是否支持上传附件。
  bool isUploadFujian() {
    if (YwxId == "N4010" || YwxId == "N4010-1") {
      return true; //fixme 需要上传附件
    }
    return false; //fixme 不需要上传附件
  }

  /// 是否新客户
  bool isNewCustomer() {
    if (NewCustomer == "1") {
      return true; //新客户
    }
    return false;
  }

  //获取审核状态
  String getOrderOrStatusName() {
    //审核状态
    if (isNotEmpty(StatusName)) {
      return StatusName!;
    }
    //订单审核状态（用于订单审核）
    if (isNotEmpty(OrderTypeName)) {
      return OrderTypeName!;
    }
    return "";
  }

  //列表根据审核状态，显示查看，还是审核
  String getShenhe(BuildContext context) {
    //fixme IsApproval 最有效
    if (IsApproval?.toLowerCase().trim() == "true") {
      return AppStrings.of(context).ToView; //查看
    }
    if (IsApproval?.toLowerCase().trim() == "false") {
      return AppStrings.of(context).audit; //审核
    }
    if (Status?.toLowerCase().trim() == AppStatusUtils.status_2) {
      return AppStrings.of(context).ToView; //查看
    }
    if (OrderType?.toLowerCase().trim() == AppStatusUtils.status_2) {
      return AppStrings.of(context).ToView; //查看
    }
    return AppStrings.of(context).audit; //审核
  }

  //判断是否已经审核过了
  bool isApproval() {
    // print(
    //     "=====================================================================IsApproval:$IsApproval\tStatus:$Status\tOrderType:$OrderType");
    //fixme IsApproval 优先级判断最高。
    var isApproval = IsApproval?.toLowerCase()?.trim();
    if (StringUtils.isNotEmpty(isApproval)) {
      if (isApproval == "true") {
        return true; //已审核
      } else if (isApproval == "false") {
        return false; //未审核
      }
    }
    if (Status?.toLowerCase().trim() == AppStatusUtils.status_2) {
      return true; //已审核
    }
    if (OrderType?.toLowerCase().trim() == AppStatusUtils.status_2) {
      return true; //已审核
    }
    return false; //未审核
  }

  //判断是否已退回
  bool isBack() {
    if (Status?.toLowerCase().trim() == AppStatusUtils.status_3) {
      return true; //已退回
    }
    return false;
  }
}
